<?php 

class UserForm extends My_Form
{	
	public function __construct()
	{
		$sBaseUrl = Zend_Registry::get('baseUrl');
		
		parent::__construct();
		
		$this->setAction($sBaseUrl.'/admin/add')
				->setMethod('post');
		
		$email = $this->createElement('text', 'email');
		$email->setDecorators($this->textDecorator);
		$email->setLabel( "Email: ");
		$email->addValidator('stringLength', false, array(4, 20))
					->setRequired(true)
					->addFilter('StringToLower');
		
		$imie = $this->createElement('text', 'imie');
		$imie->setDecorators($this->textDecorator);
		$imie->setLabel( "Imię: ");
		$imie->addValidator('regex', false, array('/^[a-z]+/'))
					->addValidator('stringLength', false, array(2, 20))
					->setRequired(true);
					
		$nazwisko = $this->createElement('text', 'nazwisko');
		$nazwisko->setDecorators($this->textDecorator);
		$nazwisko->setLabel( "Nazwisko: ");
		$nazwisko->addValidator('regex', false, array('/^[a-z]+/'))
					->addValidator('stringLength', false, array(2, 20))
					->setRequired(true);

		$submit = $this->createElement('submit', 'submit', array('label' => 'Zatwierdź'));
		$submit->setDecorators($this->submitDecorator);
		
		$this->addElement($email)
					//->addElement($imie)
					//->addElement($nazwisko)
					->addElement($submit);		
	}
}

?>
